import axios from 'axios';

/**
 * 提交客户外出申请
 * @param {Object} applyData - 包含外出申请信息的对象
 * @returns {Promise<ResponseBean<void>>}
 */
export function applyForOuting(applyData) {
    return axios({
        url: '/api/outing/apply',
        method: 'POST',
        data: applyData
    });
}
// 获取外出申请列表
export function listOutRequests(params) {
    const { pageNum, pageSize, query } = params;
    const url = `/api/outing/list?pageNum=${pageNum}&pageSize=${pageSize}`;
    return axios({ url, method: 'POST', data: query });
}

// 审核退住申请（现在发送包含审核信息的对象）
export function auditRequest(data) {
    return axios({ url: `/api/outing/audit`, method: 'PUT', data });
}

/**
 * 登记客户实际返回时间
 * @param {number|string} outingId 外出记录ID
 * @param {Date|string} returnTime 实际返回时间
 * @returns {Promise<ResponseBean<void>>}
 */
export function recordClientReturn(outingId, returnTime) {
    return axios({
        url: `/api/outing/${outingId}/return`,
        method: 'PUT',
        data: {
            returnTime // { "returnTime": "2025-06-21T..." }
        }
    });
}